function calculateMultiSelectScore(correctAnswers, userAnswers) {
  // 检查用户是否选了错误答案
  const hasWrongAnswer = userAnswers.some(
    (answer) => !correctAnswers.includes(answer)
  );
  if (hasWrongAnswer) {
    return 0;
  }

  // 检查是否完全正确
  if (userAnswers.length === correctAnswers.length) {
    return 5;
  }

  // 处理少选情况，每个正确选项得1分
  return 1;
}

const correct = ['A', 'B', 'C'];

console.log(calculateMultiSelectScore(correct, ['A', 'B', 'D'])); // 5分（全对）